home *** CD-ROM | disk | FTP | other *** search
- From: graphics_addict@msn.com (Alan Armstrong)
- Subject: inline asm in member fn
- Date: 22 Jan 96 23:14:18 -0800
- Message-ID: <00001a81+000091f1@msn.com>
- Path: news.msn.com!msn.com
- Newsgroups: comp.lang.c++
- Organization: The Microsoft Network (msn.com)
-
-
- Hello,
-
- I am getting an expression syntax error in the following member
- function. The comiler points to the line marked with "->"
- My manual states that this is a catchall compile error.
- I have used this code in a standard function, and it has worked fine.
- The only caveats about the inline code I am aware of is that the
- 1st brace "{" must be on the same line as the keyword "asm" and
- the end of each instruction is signaled by a new line or semicolon.
- I commented out the line pointed to by the compiler and the code
- compiled successfully, although it is useless without the line.
-
-
- /***************************************************************
- * *
- * Screen::Fill_Screen() *
- * *
- * This function will fill the entire screen with the sent *
- * color. *
- * *
- * arguments *
- * *
- * int(color): color to fill the screen with *
- * *
- * returns: void *
- * *
- ***************************************************************/
- void Screen::Fill_Screen(int color)
- {
- // use the inline assembler for speed
- asm {
- -> les di,video_buffer // point es:di to video buffer
- mov al,BYTE PTR color // move the color into al
- mov ah,al // replicate color into ah
- mov cx,320*200/2 // number of words to fill
- // (using words is faster than bytes)
- rep stosw // move the color into the video
- // buffer really fast!
- } // end inline asm
-
- } // end Fill_Screen
-
-
- Here's the relevant part of the Screen class definition
-
- class Screen {
- protected:
- unsigned char far *video_buffer;
- public:
- .
- .
- .
- // paints the screen with color
- void Fill_Screen(int color);
- .
- .
- .
- };
-
- Any help is greatly appreciated!
-
- Thanks,
-
- Alan <graphics_addict@msn.com>
-